package com.luhy.controller;

import com.luhy.pojo.Course;
import com.luhy.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping
public class CourseController {

    @Autowired
    private CourseService courseService;

    @GetMapping
    public String queryAll(Model model){
        List<Course> courses = courseService.queryAll();
        model.addAttribute("list", courses);
        return "course";
    }
}
